
package suncertify.ui;

import suncertify.shared.DBConfigUI;
import suncertify.shared.DBConfigController;
import java.util.logging.Level;
import java.util.logging.Logger;
import suncertify.shared.DefaultConfig;


/**
 *
 * @author jshah
 * A Runnable class to display the <code>ClientConfigUI</code> and <code>CSRScreenDisplay</code>
 */

    public class ConfigScreenDisplay implements Runnable {
        DBConfigUI         configScreen;
        DBConfigController configScreenController;
        CSRScreenDisplay csrScreen;
        boolean close;

        public void run() {

            if(DefaultConfig.LOCALMODE){
              
                this.configScreenController = new DBConfigController();
                this.configScreen = new DBConfigUI(this.configScreenController);
                this.configScreenController.setInstance(configScreen);

                while(!ClientTest.showCSR){

                }

                this.configScreen.getClientConfigScreen().setVisible(false);
            }

            else{
                Thread rmiscreen = new Thread(new ClientRmiDisplay());
                rmiscreen.start();
                try {
                    rmiscreen.join();
                    ClientTest.showCSR = true;
                } catch (InterruptedException ex) {
                    Logger.getLogger(ConfigScreenDisplay.class.getName()).log(Level.SEVERE, null, ex);
                }
                
            }
        }
        /**
         * method to launch <code>CSRScreen</code>
         */
        public void csrScreenLauncher(){

         this.csrScreen = new CSRScreenDisplay();
         new Thread(this.csrScreen).start();
        }
    }

   


